version 18.5
cd "[INSERT WORKING DIRECTORY HERE]"
use "data_wind_energy_acceptability.dta", clear

********************************************************************************
**** Dataprep ******************************************************************
********************************************************************************
drop if straightliner==1
drop if country==2

label define country 1"USA" 2"Sweden" 3"South Africa" 4"India" 5"Germany" 6"Brazil"
label val country country

recode Q2b 1/3=0 4/5=1, gen(revenue_pos)
gen gsouth=.
replace gsouth=1 if country==3 | country==4 | country==6
replace gsouth=0 if country==1 | country==5

recode q2_1 1/3=0 4/5=1, gen(q2_1_pos)
recode q2_2 1/3=0 4/5=1, gen(q2_2_pos)
recode Q2b 1/3=0 4/5=1, gen(Q2b_pos)

gen diff=Q2b-q2_2
tab diff

recode diff -4/-1=1 0/4=0, gen(diff_neg)		// more negative
recode diff -4/-1=0 0=1 1/4=0, gen(diff_none)	// no change
recode diff -4/0=0 1/4=1, gen(diff_pos)			// more positive

********************************************************************************
****************** Controls ****************************************************
********************************************************************************

***** Categorical variables --> dummy variables
qui tab age_3,		gen(agecat)
qui tab education,	gen(educat)
qui tab urban,		gen(urbcat)
qui tab pinc,		gen(inccat)

***** Ideology
alpha q9_1 q9_4 q9_5, item
bysort country: alpha q9_1 q9_4 q9_5, item
gen ideology=(q9_1 + q9_4 + q9_5)/3

***** Political trust
alpha q10_5 q10_6 q10_7, item gen(polindex)
gen poltrust=polindex-1

**************************************************************
***** Standardizing variables
egen std_gender=std(gender)
egen std_agecat1=std(agecat1)
egen std_agecat2=std(agecat2)
egen std_agecat3=std(agecat3)
egen std_educat1=std(educat1)
egen std_educat2=std(educat2)
egen std_educat3=std(educat3)
egen std_urbcat1=std(urbcat1)
egen std_urbcat2=std(urbcat2)
egen std_urbcat3=std(urbcat3)
egen std_inccat1=std(inccat1)
egen std_inccat2=std(inccat2)
egen std_inccat3=std(inccat3)
egen std_ideology=std(ideology)
egen std_climate_concern=std(climate_concern)
egen std_poltrust=std(poltrust)

**** Labels
label var gender				"Female"
label var std_gender			"Female"
label var std_agecat1			"18-34 years"
label var std_agecat2			"35-54 years"
label var std_agecat3			"55+ years"
label var std_educat1			"Low"
label var std_educat2			"Medium"
label var std_educat3			"High"
label var std_urbcat1			"Urban"
label var std_urbcat2			"Suburban"
label var std_urbcat3			"Rural"
label var std_inccat1			"Low"
label var std_inccat2			"Medium"
label var std_inccat3			"High"
label var std_ideology			"Ideology"
label var ideology				"Ideology"
label var climate_concern		"Climate concern"
label var std_climate_concern	"Climate concern"
label var poltrust				"Political trust"
label var std_poltrust			"Political trust"
**************************************************************

**** Global variables
global dvars	"q2_1 q2_2 Q2b"
global diffvars	"diff_neg diff_none diff_pos"
global ivars	"std_poltrust std_ideology std_climate_concern std_gender std_inccat2 std_inccat3 std_educat2 std_educat3 std_agecat2 std_agecat3 std_urbcat2 std_urbcat3"


**** RESULTS *******************************************************************
* Table 3. Sample size
tab country

* Table 4. Descriptive statistics - Main variables
sum q2_1 q2_2 Q2b

* Table 5. Descriptive statistics - Independent and control variables
sum poltrust ideology climate_concern gender pinc education age_3 urban

* Table 6. Frequency of responses for each response category for question ///
 concerning more wind turbines in your region (percent)
tab q2_2
bysort countr: tab q2_2

* Table 7. Frequency of responses for each response category for the question ///
 concerning more wind turbines in your region, and let some of the generated ///
 revenue compensate those living in the vicinity of the turbines (percent)
tab Q2b
bysort countr: tab Q2b

* Table 8. Differences of means without and with compensation
foreach i of numlist 1/5 {
sum Q2b if q2_2==`i'
}
foreach country of numlist 6 5 4 3 1 {
tab country if country==`country'
foreach i of numlist 1/5 {
sum Q2b if q2_2==`i' & country==`country'
}
}

* Table 9. Logistic regression analyses of differences in attitude shifts ///
 in the total sample
** All countries
global tabname "Logit_diff_all"
foreach diffvar of varlist $diffvars {
local x=`x'+1
di "Column `x'"
qui logit `diffvar' $ivars [pweight=weight], robust
local z`x' m_`x'
local z = "`z'" + " `z`x''"
est store m_`x'
local m="c`x'"
}
* Stata output
esttab `z' , ///
	mtitles("All: More negative" "All: No change" "All: More positive") ///
	addnotes("Comments: Standardized coefficients, robust standard errors") ///
	keep() ///
	order() ///
	cells(b(star fmt(%8.3f) ) se( par fmt(%6.3f)) ) ///
	stats(N pr2, fmt(%9.0f %9.2f)) ///
	starlevels(* 0.05 ** 0.01 *** 0.001) r2(3) ///
	legend
est clear

********************************************************************************
***************** EXTENDED RESULTS *********************************************
********************************************************************************

********************************************************************************
***************** RQ #1 ********************************************************
********************************************************************************
** RQ1 Table, percentage positive
sum q2_1_pos q2_2_pos Q2b_pos
foreach i of numlist 6 5 4 3 1 {
tab country if country==`i'
sum q2_1_pos q2_2_pos Q2b_pos if country==`i'
}

**** ttests
ttest q2_1 == q2_2
ttest q2_2 == Q2b
ttest q2_1 == Q2b
bysort country: ttest q2_1 == q2_2
bysort country: ttest q2_2 == Q2b
bysort country: ttest q2_1 == Q2b

**** test of proportions
* Table x. Two-sample test of resistance (strongly against and somewhat against) proportions
tab q2_1_pos
tab q2_2_pos
prtesti 5987 .6918 5630 .6506

tab q2_1_pos if country==x //change x
tab q2_2_pos if country==x //change x
prtesti 1385 .8161 1318 .7767 //Brazil
prtesti 1199 .6595 1079 .5935 //Germany
prtesti 1082 .6570 1017 .6175 //India
prtesti 1344 .7662 1304 .7434 //South Africa
prtesti 977 .5621 912 .5247 //USA

********************************************************************************
** RQ #1 BAR CHART *************************************************************
********************************************************************************
** DATA FOR BAR CHART **
************************
** q2_1 Establish more wind turbines in your country
* all countries
ci means q2_1_pos
gen mean_q2_1_all=r(mean)*100
gen lb_q2_1_all=r(lb)*100
gen ub_q2_1_all=r(ub)*100
* by country
foreach i of numlist 1 3 4 5 6 {
	ci means q2_1_pos if country==`i'
	gen mean_q2_1_`i'=r(mean)*100
	gen lb_q2_1_`i'=r(lb)*100
	gen ub_q2_1_`i'=r(ub)*100
}

** q2_2 Establish more wind turbines in your region
* all countries
ci means q2_2_pos
gen mean_q2_2_all=r(mean)*100
gen lb_q2_2_all=r(lb)*100
gen ub_q2_2_all=r(ub)*100
* by country
foreach i of numlist 1 3 4 5 6 {
	ci means q2_2_pos if country==`i'
	gen mean_q2_2_`i'=r(mean)*100
	gen lb_q2_2_`i'=r(lb)*100
	gen ub_q2_2_`i'=r(ub)*100
}

** Q2b Establish more wind turbines in your region and let some of the generated revenue compensate those living in the vicinity of the turbines
* all countries
ci means Q2b_pos
gen mean_Q2b_all=r(mean)*100
gen lb_Q2b_all=r(lb)*100
gen ub_Q2b_all=r(ub)*100
* by country
foreach i of numlist 1 3 4 5 6 {
	ci means Q2b_pos if country==`i'
	gen mean_Q2b_`i'=r(mean)*100
	gen lb_Q2b_`i'=r(lb)*100
	gen ub_Q2b_`i'=r(ub)*100
}

gen pos1=1
gen pos2=2
gen pos3=3
gen pos4=4
gen pos5=5
gen pos6=6
gen pos1b=pos1+0.4
gen pos2b=pos2+0.4
gen pos3b=pos3+0.4
gen pos4b=pos4+0.4
gen pos5b=pos5+0.4
gen pos6b=pos6+0.4

gen noll=0
gen mlab1=round(mean_q2_1_all)
gen mlab2=round(mean_q2_2_all)
gen mlab3=round(mean_q2_1_6)
gen mlab4=round(mean_q2_2_6)
gen mlab5=round(mean_q2_1_5)
gen mlab6=round(mean_q2_2_5)
gen mlab7=round(mean_q2_1_4)
gen mlab8=round(mean_q2_2_4)
gen mlab9=round(mean_q2_1_3)
gen mlab10=round(mean_q2_2_3)
gen mlab11=round(mean_q2_1_1)
gen mlab12=round(mean_q2_2_1)
*format %9.2f mlab*

gen mlab1_pos=ub_q2_1_all + 2
gen mlab2_pos=ub_q2_2_all + 2
gen mlab3_pos=ub_q2_1_6 + 2
gen mlab4_pos=ub_q2_2_6 + 2
gen mlab5_pos=ub_q2_1_5 + 2
gen mlab6_pos=ub_q2_2_5 + 2
gen mlab7_pos=ub_q2_1_4 + 2
gen mlab8_pos=ub_q2_2_4 + 2
gen mlab9_pos=ub_q2_1_3 + 2
gen mlab10_pos=ub_q2_2_3 + 2
gen mlab11_pos=ub_q2_1_1 + 2
gen mlab12_pos=ub_q2_2_1 + 2

****************
** BAR CHARTS **
****************
set scheme white_tableau
graph set window fontface "Arial"
twoway ///
(bar mean_q2_1_all pos1,  barw(0.35) color("0 114 178")) ///
(rcap lb_q2_1_all ub_q2_1_all pos1, lcolor(gray%30) lwidth(vthin)) ///
(bar mean_q2_2_all pos1b, barw(0.35) color("153 194 255")) ///
(rcap lb_q2_2_all ub_q2_2_all pos1b, lcolor(gray%30) lwidth(vthin)) ///
(bar mean_q2_1_6 pos2,  barw(0.35) color("230 159 0")) ///
(rcap lb_q2_1_6 ub_q2_1_6 pos2, lcolor(gray%30) lwidth(vthin)) ///
(bar mean_q2_2_6 pos2b, barw(0.35) color("255 210 128")) ///
(rcap lb_q2_2_6 ub_q2_2_6 pos2b, lcolor(gray%30) lwidth(vthin)) ///
(bar mean_q2_1_5 pos3,  barw(0.35) color("213 94 0")) ///
(rcap lb_q2_1_5 ub_q2_1_5 pos3, lcolor(gray%30) lwidth(vthin)) ///
(bar mean_q2_2_5 pos3b, barw(0.35) color("255 163 128")) ///
(rcap lb_q2_2_5 ub_q2_2_5 pos3b, lcolor(gray%30) lwidth(vthin)) ///
(bar mean_q2_1_4 pos4,  barw(0.35) color("0 158 115")) ///
(rcap lb_q2_1_4 ub_q2_1_4 pos4, lcolor(gray%30) lwidth(vthin)) ///
(bar mean_q2_2_4 pos4b, barw(0.35) color("128 218 182")) ///
(rcap lb_q2_2_4 ub_q2_2_4 pos4b, lcolor(gray%30) lwidth(vthin)) ///
(bar mean_q2_1_3 pos5,  barw(0.35) color("204 121 167")) ///
(rcap lb_q2_1_3 ub_q2_1_3 pos5, lcolor(gray%30) lwidth(vthin)) ///
(bar mean_q2_2_3 pos5b, barw(0.35) color("233 184 212")) ///
(rcap lb_q2_2_3 ub_q2_2_3 pos5b, lcolor(gray%30) lwidth(vthin)) ///
(bar mean_q2_1_1 pos6,  barw(0.35) color("240 228 66")) ///
(rcap lb_q2_1_1 ub_q2_1_1 pos6, lcolor(gray%30) lwidth(vthin)) ///
(bar mean_q2_2_1 pos6b, barw(0.35) color("255 245 170")) ///
(rcap lb_q2_2_1 ub_q2_2_1 pos6b, lcolor(gray%30) lwidth(vthin)) ///
(scatter mlab1_pos  pos1,  mlab(mlab1)  mlabsize(vsmall) mlabpos(0) mlabcolor(black%70) msymbol(none)) ///
(scatter mlab2_pos 	pos1b, mlab(mlab2)  mlabsize(vsmall) mlabpos(0) mlabcolor(black%70) msymbol(none)) ///
(scatter mlab3_pos 	pos2,  mlab(mlab3)  mlabsize(vsmall) mlabpos(0) mlabcolor(black%70) msymbol(none)) ///
(scatter mlab4_pos 	pos2b, mlab(mlab4)  mlabsize(vsmall) mlabpos(0) mlabcolor(black%70) msymbol(none)) ///
(scatter mlab5_pos 	pos3,  mlab(mlab5)  mlabsize(vsmall) mlabpos(0) mlabcolor(black%70) msymbol(none)) ///
(scatter mlab6_pos 	pos3b, mlab(mlab6)  mlabsize(vsmall) mlabpos(0) mlabcolor(black%70) msymbol(none)) ///
(scatter mlab7_pos 	pos4,  mlab(mlab7)  mlabsize(vsmall) mlabpos(0) mlabcolor(black%70) msymbol(none)) ///
(scatter mlab8_pos 	pos4b, mlab(mlab8)  mlabsize(vsmall) mlabpos(0) mlabcolor(black%70) msymbol(none)) ///
(scatter mlab9_pos	pos5,  mlab(mlab9)  mlabsize(vsmall) mlabpos(0) mlabcolor(black%70) msymbol(none)) ///
(scatter mlab10_pos	pos5b, mlab(mlab10) mlabsize(vsmall) mlabpos(0) mlabcolor(black%70) msymbol(none)) ///
(scatter mlab11_pos	pos6,  mlab(mlab11) mlabsize(vsmall) mlabpos(0) mlabcolor(black%70) msymbol(none)) ///
(scatter mlab12_pos	pos6b, mlab(mlab12) mlabsize(vsmall) mlabpos(0) mlabcolor(black%70) msymbol(none)) ///
, legend(order(1 5 9 13 17 21 3 7 11 15 19 23) lab(1 "All countries: country") lab(3 "All countries: region") lab(5 "Brazil: country") lab(7 "Brazil: region") lab(9 "Germany: country") lab(11 "Germany: region") lab(13 "India: country") lab(15 "India: region") lab(17 "South Africa: country") lab(19 "South Africa: region") lab(21 "USA: country") lab(23 "USA: region") row(2) pos(6) size(vsmall)) xlab(, nogrid) xscale(off) ylab(0(10)100, gmin gmax labsize(vsmall)) graphregion(color(white)) plotregion(margin(1 1 1 1)) ytitle("Percent acceptability", size(vsmall)) name("figure_1", replace)
graph export "graphs\figure_1.png", replace
graph export "graphs\figure_1.pdf", replace
graph export "graphs\figure_1.eps", replace


********************************************************************************
***************** RQ #2 ********************************************************
********************************************************************************
bysort q2_2: sum Q2b
foreach i of numlist 6 5 4 3 1 {
	tab country if country==`i'
	bysort q2_2: sum Q2b if country==`i'
}


recode q2_2 1/2=1 3/5=0, gen(q2_2_oppo) //opponent
recode q2_2 1/3=0 4/5=1, gen(q2_2_prop) //proponent

*br Q2b q2_2 diff q2_2_oppo q2_2_prop if diff <=-1

**** OPPONENTS
sum poltrust ideology climate_concern corruption gender pinc education age_3 urban if q2_2_oppo==1 & diff<=-1 //opponents, more negative
sum poltrust ideology climate_concern corruption gender pinc education age_3 urban if q2_2_oppo==1 & diff==0 //opponents, no change
sum poltrust ideology climate_concern corruption gender pinc education age_3 urban if q2_2_oppo==1 & diff>=1 //opponents, more positive


**** PROPONENTS
sum poltrust ideology climate_concern corruption gender pinc education age_3 urban if q2_2_prop==1 & diff<=-1 //proponents, more negative
sum poltrust ideology climate_concern corruption gender pinc education age_3 urban if q2_2_prop==1 & diff==0 //proponents, no change
sum poltrust ideology climate_concern corruption gender pinc education age_3 urban if q2_2_prop==1 & diff>=1 //proponents, more positive



*************************************** Diff analysis
** All countries
global tabname "Logit_diff_all"
foreach diffvar of varlist $diffvars {
local x=`x'+1
di "Column `x'"
qui logit `diffvar' $ivars [pweight=weight], robust
local z`x' m_`x'
local z = "`z'" + " `z`x''"
est store m_`x'
local m="c`x'"
}
* Stata output
esttab `z' , ///
	mtitles("All: More negative" "All: No change" "All: More positive") ///
	addnotes("Comments: Standardized coefficients, robust standard errors") ///
	keep() ///
	order() ///
	cells(b(star fmt(%8.3f) ) se( par fmt(%6.3f)) ) ///
	stats(N pr2, fmt(%9.0f %9.2f)) ///
	starlevels(* 0.05 ** 0.01 *** 0.001) r2(3) ///
	legend
* Excel output
estout `z' using "output/$tabname.xls", replace ///
	mlabels("All: More negative" "All: No change" "All: More positive") ///
	postfoot("Comments: Standardized coefficients, robust standard errors") ///
	keep() ///
	order() ///
	cells(b(star fmt(%8.3f) ) se( par(`"="("' `")""') fmt(%6.3f)) ) ///
	stats(N pr2, fmt(%9.0f %9.2f)) ///
	starlevels(* 0.05 ** 0.01 *** 0.001) ///
	legend
*est clear

** By country
global tabname "Logit_diff_country"
foreach i of numlist 6 5 4 3 1 {
foreach diffvar of varlist $diffvars {
local x=`x'+1
di "Column `x'"
qui logit `diffvar' $ivars [pweight=weight] if country==`i', robust
local z`x' m_`x'
local z = "`z'" + " `z`x''"
est store m_`x'
local m="c`x'"
}
}
* Stata output
esttab `z' , ///
	mtitles("BR: More negative" "BR: No change" "BR: More positive" "DE: More negative" "DE: No change" "DE: More positive" "IN: More negative" "IN: No change" "IN: More positive" "SA: More negative" "SA: No change" "SA: More positive" "US: More negative" "US: No change" "US: More positive") ///
	addnotes("Comments: Standardized coefficients, robust standard errors") ///
	keep() ///
	order() ///
	cells(b(star fmt(%8.3f) ) se( par fmt(%6.3f)) ) ///
	stats(N pr2, fmt(%9.0f %9.2f)) ///
	starlevels(* 0.05 ** 0.01 *** 0.001) r2(3) ///
	legend
* Excel output
estout `z' using "output/$tabname.xls", replace ///
	mlabels("BR: More negative" "BR: No change" "BR: More positive" "DE: More negative" "DE: No change" "DE: More positive" "IN: More negative" "IN: No change" "IN: More positive" "SA: More negative" "SA: No change" "SA: More positive" "US: More negative" "US: No change" "US: More positive") ///
	postfoot("Comments: Standardized coefficients, robust standard errors") ///
	keep() ///
	order() ///
	cells(b(star fmt(%8.3f) ) se( par(`"="("' `")""') fmt(%6.3f)) ) ///
	stats(N pr2, fmt(%9.0f %9.2f)) ///
	starlevels(* 0.05 ** 0.01 *** 0.001) ///
	legend
*est clear

********** Diff analysis: coefplot
*** PANEL ROW 1
set scheme white_tableau
graph set window fontface "Arial"
coefplot	(m_4, msymbol(T) mlcolor("0 0 0") mfcolor("100 100 100") ciopts(lcolor("100 100 100"))) (m_5, msymbol(O) mlcolor("0 0 0") mfcolor("150 150 150") ciopts(lcolor("150 150 150"))) (m_6, msymbol(D) mlcolor("0 0 0") mfcolor("50 50 50") ciopts(lcolor("50 50 50"))), bylabel(Brazil) || m_7 m_8 m_9, bylabel(Germany) || m_10 m_11 m_12, bylabel(India) ///
			keep(std_poltrust std_ideology std_climate_concern) xline(0, lcolor(red)) xlabel(-.4(.2).4, gmin gmax) ///
			subtitle(, bcolor(white)) ///
			headings(gender="{it:Gender}" 2.age_3="{it:Age}" ///
			2.education="{it:Education}" 2.urban="{it:Region}" ///
			2.pinc="{it:Personal income}", labs(small)) ///
			byopts(row(1)) legend(order(100 "") row(1) pos(6)) ///
			name(diff_coefplot_1, replace) xsize(6) graphregion(margin(zero))
			
*** PANEL ROW 2
set scheme white_tableau
graph set window fontface "Arial"
coefplot	(m_13, msymbol(T) mlcolor("0 0 0") mfcolor("100 100 100") ciopts(lcolor("100 100 100"))) (m_14, msymbol(O) mlcolor("0 0 0") mfcolor("150 150 150") ciopts(lcolor("150 150 150"))) (m_15, msymbol(D) mlcolor("0 0 0") mfcolor("50 50 50") ciopts(lcolor("50 50 50"))), bylabel(South Africa) || m_16 m_17 m_18, bylabel(USA) || m_1 m_2 m_3, bylabel(All countries) ///
			keep(std_poltrust std_ideology std_climate_concern) xline(0, lcolor(red)) xlabel(-.4(.2).4, gmin gmax) ///
			subtitle(, bcolor(white)) ///
			headings(gender="{it:Gender}" 2.age_3="{it:Age}" ///
			2.education="{it:Education}" 2.urban="{it:Region}" ///
			2.pinc="{it:Personal income}", labs(small)) ///
			byopts(row(1)) legend(order(2 "More negative" 4 "No change" 6 "More positive") row(1) pos(6)) name(diff_coefplot_2, replace) xsize(6) graphregion(margin(zero))

graph combine diff_coefplot_1 diff_coefplot_2, title("") iscale(.8) xsize(3) graphregion(margin(zero)) col(1) name("diff_coefplot", replace)
gr export "output/diff_coefplot.pdf", as(pdf) name("diff_coefplot") replace	
gr export "output/diff_coefplot.eps", as(eps) name("diff_coefplot") replace
gr export "output/diff_coefplot.png", as(png) name("diff_coefplot") replace
est clear


********************************************************************************
***************** RQ #3 ********************************************************
********************************************************************************
** All countries
global tabname "Ologit_all"
foreach dv of varlist $dvars {
local x=`x'+1
di "Column `x'"
qui ologit `dv' $ivars [pweight=weight], robust
local z`x' m_`x'
local z = "`z'" + " `z`x''"
est store m_`x'
local m="c`x'"
}
* Stata output
esttab `z' , ///
	mtitles("All: q2_1" "All: q2_2" "All: Q2b") ///
	addnotes("Comments: Standardized coefficients, robust standard errors") ///
	keep() ///
	order() ///
	cells(b(star fmt(%8.3f) ) se( par fmt(%6.3f)) ) ///
	stats(N pr2, fmt(%9.0f %9.2f)) ///
	starlevels(* 0.05 ** 0.01 *** 0.001) r2(3) ///
	legend
* Excel output
estout `z' using "output/$tabname.xls", replace ///
	mlabels("All: q2_1" "All: q2_2" "All: Q2b") ///
	postfoot("Comments: Standardized coefficients, robust standard errors") ///
	keep() ///
	order() ///
	cells(b(star fmt(%8.3f) ) se( par(`"="("' `")""') fmt(%6.3f)) ) ///
	stats(N pr2, fmt(%9.0f %9.2f)) ///
	starlevels(* 0.05 ** 0.01 *** 0.001) ///
	legend
*est clear

** By country
global tabname "Ologit_country"
foreach i of numlist 6 5 4 3 1 {
foreach dv of varlist $dvars {
local x=`x'+1
di "Column `x'"
qui ologit `dv' $ivars [pweight=weight] if country==`i', robust
local z`x' m_`x'
local z = "`z'" + " `z`x''"
est store m_`x'
local m="c`x'"
}
}
* Stata output
esttab `z' , ///
	mtitles("BR: q2_1" "BR: q2_2" "BR: Q2b" "DE: q2_1" "DE: q2_2" "DE: Q2b" "IN: q2_1" "IN: q2_2" "IN: Q2b" "SA: q2_1" "SA: q2_2" "SA: Q2b" "US: q2_1" "US: q2_2" "US: Q2b") ///
	addnotes("Comments: Standardized coefficients, robust standard errors") ///
	keep() ///
	order() ///
	cells(b(star fmt(%8.3f) ) se( par fmt(%6.3f)) ) ///
	stats(N pr2, fmt(%9.0f %9.2f)) ///
	starlevels(* 0.05 ** 0.01 *** 0.001) r2(3) ///
	legend
* Excel output
estout `z' using "output/$tabname.xls", replace ///
	mlabels("BR: q2_1" "BR: q2_2" "BR: Q2b" "DE: q2_1" "DE: q2_2" "DE: Q2b" "IN: q2_1" "IN: q2_2" "IN: Q2b" "SA: q2_1" "SA: q2_2" "SA: Q2b" "US: q2_1" "US: q2_2" "US: Q2b") ///
	postfoot("Comments: Standardized coefficients, robust standard errors") ///
	keep() ///
	order() ///
	cells(b(star fmt(%8.3f) ) se( par(`"="("' `")""') fmt(%6.3f)) ) ///
	stats(N pr2, fmt(%9.0f %9.2f)) ///
	starlevels(* 0.05 ** 0.01 *** 0.001) ///
	legend
*est clear

********** Coefplot
*** PANEL ROW 1
set scheme white_tableau
graph set window fontface "Arial"
coefplot	(m_4, msymbol(T) mlcolor("0 0 0") mfcolor("100 100 100") ciopts(lcolor("100 100 100"))) (m_5, msymbol(O) mlcolor("0 0 0") mfcolor("150 150 150") ciopts(lcolor("150 150 150"))) (m_6, msymbol(D) mlcolor("0 0 0") mfcolor("50 50 50") ciopts(lcolor("50 50 50"))), bylabel(Brazil) || m_7 m_8 m_9, bylabel(Germany) || m_10 m_11 m_12, bylabel(India) ///
			keep(std_poltrust std_ideology std_climate_concern) xline(0, lcolor(red)) xlabel(-.8(.2).8, gmin gmax) ///
			subtitle(, bcolor(white)) ///
			headings(gender="{it:Gender}" 2.age_3="{it:Age}" ///
			2.education="{it:Education}" 2.urban="{it:Region}" ///
			2.pinc="{it:Personal income}", labs(small)) ///
			byopts(row(1)) legend(order(100 "") row(1) pos(6)) ///
			name(coefplot_1, replace) xsize(6) graphregion(margin(zero))
			
*** PANEL ROW 2
set scheme white_tableau
graph set window fontface "Arial"
coefplot	(m_13, msymbol(T) mlcolor("0 0 0") mfcolor("100 100 100") ciopts(lcolor("100 100 100"))) (m_14, msymbol(O) mlcolor("0 0 0") mfcolor("150 150 150") ciopts(lcolor("150 150 150"))) (m_15, msymbol(D) mlcolor("0 0 0") mfcolor("50 50 50") ciopts(lcolor("50 50 50"))), bylabel(South Africa) || m_16 m_17 m_18, bylabel(USA) || m_1 m_2 m_3, bylabel(All countries) ///
			keep(std_poltrust std_ideology std_climate_concern) xline(0, lcolor(red)) xlabel(-.8(.2).8, gmin gmax) ///
			subtitle(, bcolor(white)) ///
			headings(gender="{it:Gender}" 2.age_3="{it:Age}" ///
			2.education="{it:Education}" 2.urban="{it:Region}" ///
			2.pinc="{it:Personal income}", labs(small)) ///
			byopts(row(1)) legend(order(2 "Country" 4 "Region" 6 "Region + compensation") row(1) pos(6)) name(coefplot_2, replace) xsize(6) graphregion(margin(zero))

graph combine coefplot_1 coefplot_2, title("") iscale(.8) xsize(3) graphregion(margin(zero)) col(1) name("coefplot", replace)
gr export "output/coefplot.pdf", as(pdf) name("coefplot") replace	
gr export "output/coefplot.eps", as(eps) name("coefplot") replace
gr export "output/coefplot.png", as(png) name("coefplot") replace
est clear

